/*
   This file is part of kleber.
   Copyright 2008 Simon Schmeisser <mail_to_wrt@gmx.de>
   
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
    
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef KLEBER_PAGE_H
#define KLEBER_PAGE_H

#include <QtGui/QImage>
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QObject>

#include <QtScript>

class KleberPage :public QObject
{
	Q_OBJECT
	
	Q_PROPERTY( int numBarcodes READ numBarcodes() )
	Q_PROPERTY( int pixelWidth READ pixelWidth() )
	Q_PROPERTY( int pixelHeight READ pixelHeight() )
	Q_PROPERTY( int resolution READ resolution() )
	
	public:
		KleberPage(const QString &);
		//~KleberPage();
		
		static void registerClass(QScriptEngine *);
	
	public slots:
		bool loadImage();
		QImage image();

		void scanBarcodes();
		int numBarcodes();
		int barcode( int );

		int pixelWidth();
		int pixelHeight();

		int resolution();

	private:
		QString m_fileName;
		bool m_imageLoaded;
		QImage m_image;

		bool m_scanned;
		QList<int> m_barcodes;

		int m_pixelWidth;
		int m_pixelHeight;

		int m_resolution;
};

QScriptValue KleberPageConstructor(QScriptContext *, QScriptEngine *);

#endif

